package com.exception;

import com.utils.ApiResult;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author xiaoChen
 * @description: AUTO GENERATION
 * @date 2022/5/20 18:11
 */
@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public ApiResult handleGlobalException(Exception e) {
        return new ApiResult(500, e.getMessage(), null);
    }

}
